# bird.py
from abc import ABC, abstractmethod
from fly import FlyBehavior, FreeFly, UnableFly
from swim import SwimBehavior, AbleSwim, UnableSwim

# 抽象Bird类
class Bird(ABC):
    def __init__(self, fly_behavior: FlyBehavior, swim_behavior: SwimBehavior):
        self.fly_behavior = fly_behavior
        self.swim_behavior = swim_behavior

    def fy(self):
        self.fly_behavior.fy()

    def swim(self):
        self.swim_behavior.swim()

    @abstractmethod
    def display(self):
        pass

# 具体鸟类：鸽子
class Pigeon(Bird):
    def __init__(self):
        super().__init__(FreeFly(), UnableSwim())

    def display(self):
        print("我是一只鸽子！")

# 具体鸟类：老鹰
class Eagle(Bird):
    def __init__(self):
        super().__init__(FreeFly(), UnableSwim())

    def display(self):
        print("我是一只老鹰，天空的霸主！")

# 具体鸟类：企鹅
class Penguin(Bird):
    def __init__(self):
        super().__init__(UnableFly(), AbleSwim())

    def display(self):
        print("我是一只企鹅，我不会飞，但我游泳很厉害！")

